/*
  ESC Drive
  Felipe Polido
*/
#include <Servo.h>

Servo myservo;

int ledPin = 13;      // select the pin for the LED

int value1 =0 ;
int value2 =0 ;
int value3 =0 ;
int value = 0;

void setup() {
  
  myservo.attach(9);
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  
}

void loop() {
  
  	if (Serial.available() > 2) {
		// read the incoming byte:
	  value1 = Serial.read() -48;
          value2 = Serial.read() -48;
          value3 = Serial.read() -48;
	  Serial.print("I received: ");
          value = value1*100 + value2*10 + value3;
	  Serial.println(value);
	}
          myservo.write(value); // aceita de 0 a 180
           //dirige de 65 a 125
          delay(15);     
}
